package com.stockz.equity.charting.view.widget;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.swing.JButton;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

import com.stockz.equity.charting.view.toolbar.NavigationToolbar;
import com.stockz.equity.pattern.Child;

@Component
public class ResetScripNameComboBoxButton 
extends JButton implements Child,ActionListener,
		Ordered {

	@Autowired
	private ScripNameComboBox scripNameComboBox;
	private List<Class> parents = new ArrayList<Class>(1);
	
	public ResetScripNameComboBoxButton() {
		super("Reset");
		parents.add(NavigationToolbar.class);
		addActionListener(this);
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		scripNameComboBox.reset();
	}
	
	@Override
	public Collection<Class> getParents() {
		return parents;
	}

	@Override
	public int getOrder() {
		return 1;
	}

}
